﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;
using OnlineCooperation.Entity;
using OnlineCooperation.DB;

namespace OnlineCooperation
{
    /// <summary>
    /// DeletUser 的摘要说明
    /// </summary>
    public class DeletUser : IHttpHandler, IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            UserDB ud = new UserDB();
            User u = ud.GetUserByEmail(context.Session["UserEmail"].ToString());
            ud.Delete(u);
            context.Response.Cookies["email"].Expires = DateTime.Now.AddMonths(-1);
            context.Response.Cookies["password"].Expires = DateTime.Now.AddMonths(-1);
            context.Session.Abandon();

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}